from easymoney.dao import investment_recom_dao
from easymoney.business.stock.webdriver import stock_info_service

# 更新数据库种所有股票的价格
if __name__ == "__main__":
    all_records = investment_recom_dao.get_all()
    for record in all_records:
        print(f"股票代码: {record.stock_code}, 名称: {record.stock_name}, 价格: {record.stock_price}")
        result = stock_info_service.get_stock_info_crawler(record.stock_code)
        if result and '当前价格' in result:
            investment_recom_dao.update_price(record.stock_code, result.get('当前价格'))
